﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.ServiceModel;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Charley.WCF.Demo.MoneyMangement.Contract;

namespace Charley.WCF.Demo.MoneyMangement.Client.Winform
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        ChannelFactory<IMoneyService> _factory;
        IMoneyService _srv;

        private void Form1_Load(object sender, EventArgs e)
        {
            _factory = new ChannelFactory<IMoneyService>(new BasicHttpBinding(), "http://localhost:9999/");
            _srv = _factory.CreateChannel();
        }

        private void btnDeposit_Click(object sender, EventArgs e)
        {
            _srv.Deposit(numDeposit.Value);
        }

        private void btnRefresh_Click(object sender, EventArgs e)
        {
            lblDeposit.Text = _srv.GetTotal().ToString();
        }
    }
}
